/*******************************************************************************
MapKit.h

	Author:		LiuDingXi
	e-mail:		liudx@gmail.com
	Date time:	2009-08-07

	Copyright (C) 2009
	All rights reserved.
	
*******************************************************************************/
#ifndef _MAPKIT_H_
#define  _MAPKIT_H_

#include "BaseParser.h"
#include "ximage.h"

class CMapKit : public CBaseParser
{
public:
	CMapKit();
	virtual ~CMapKit();

public:
	BOOL	Load(CArchive& ar);
	BOOL	Store(CArchive& ar);

	BOOL	Free();

	struct TPOS
	{
		CString	szName;
		int	x;
		int y;
		int cx;
		int cy;
	};

	struct TIMG
	{
		CString szName;
		CString szFile;
		CxImage	xImage;
		int		nFlag;
		int		x;
		int		y;
		int		cx;
		int		cy;

		SceneDat::INT idx;
	};

	struct TILE
	{
		TIMG*	pImage;
		int		x;
		int		y;
	};

	struct TMAP
	{
		TMAP();
		~TMAP();
		
		CString	szType;
		CString szName;

		int		nWidth;
		int		nHeight;

		list<TIMG*>	ImgList;
		list<TILE*> TileList;
		list<TPOS*>	PosList;

		void OnDraw(CDC* pDC, int x, int y);

		void AddImg(LPCTSTR p, LPCTSTR szFolder);
		void AddPos(LPCTSTR p);
		void AddTile(LPCTSTR p);

		SceneDat::INT idx;
	};

	list<TMAP*>	m_MapList;

	TMAP* AddMap(LPCTSTR p, LPCTSTR szFolder);

	TMAP* FindMap(LPCTSTR szName);

};

#endif// _MAPKIT_H_
